<template>
  <div class="app-container" v-loading.fullscreen.lock="submitLoading">
    <el-card class="box-card">
      <div class="add_over">
        <div>
          <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="80px" status-icon class="demo-ruleForm">
            <div>
              <div class="flex">
                <div>
                  <el-form-item label="合同标题" prop="title">
                    <template>
                      <el-input v-model="ruleForm.title" placeholder="请输入合同标题"></el-input>
                    </template>
                  </el-form-item>
                  <el-form-item label="委托单位" prop="entrust_unit">
                    <template>
                      <el-input v-model="ruleForm.entrust_unit" placeholder="请输入委托单位"></el-input>
                    </template>
                  </el-form-item>
                  <!-- <el-form-item label="合同总额" prop="price">
                      <template>
                        <el-input v-model="ruleForm.price" placeholder="请输入合同总额"></el-input>
                      </template>
                    </el-form-item> -->
                    <el-form-item label="生效日期">
                      <template>
                        <el-date-picker
                        v-model="ruleForm.shengxiao_date"
                        type="datetime"
                        placeholder="选择日期时间"
                        format="yyyy-MM-dd HH:mm:ss"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        >
                        </el-date-picker>
                      </template>
                    </el-form-item>
                  <!-- <el-form-item label="生效日期" prop="shengxiao_date">
                    <template>
                      <el-date-picker v-model="ruleForm.shengxiao_date" type="datetime" placeholder="选择日期时间"
                         format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss">
                      </el-date-picker>
                    </template>
                  </el-form-item> -->
                  <el-form-item label="截止日期">
                    <template>
                      <el-date-picker v-model="ruleForm.jiezhi_date" type="datetime" placeholder="选择日期时间"
                         format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss">
                      </el-date-picker>
                    </template>
                  </el-form-item>
                  <el-form-item label="负责人员" prop="market_person_name">
                      <div @click="person_click()">
                        <el-input v-model="ruleForm.market_person_name" placeholder="请点击输入框" ref="mark"></el-input>
                      </div>
                      <!-- <el-popover placement="bottom-start" width="1000" trigger="click" v-model="visibla">
                        <el-input v-model="ruleForm.market_person_name" slot="reference" placeholder="请点击输入框"></el-input>
                      </el-popover> -->
                  </el-form-item>
                  <el-form-item label="合同分类">
                    <template>
                      <!-- <el-input v-model="ruleForm.type"></el-input> -->
                      <el-radio v-model="ruleForm.type" :label="1">单价合同</el-radio>
                      <el-radio v-model="ruleForm.type" :label="2">总价合同</el-radio>
                    </template>
                  </el-form-item>
                </div>
                <div>
                  <el-form-item label="合同编号" prop="contract_num">
                    <template>
                      <el-input v-model="ruleForm.contract_num" placeholder="请输入合同编码"></el-input>
                    </template>
                  </el-form-item>
                  <el-form-item label="建设单位" prop="build_position">
                    <template>
                      <el-input v-model="ruleForm.build_position" placeholder="请输入建设单位"></el-input>
                    </template>
                  </el-form-item>
                  <el-form-item label="签约日期">
                    <template>
                      <!-- <el-input v-model="ruleForm.qianyue_date"></el-input> -->
                      <el-date-picker v-model="ruleForm.qianyue_date" type="datetime" placeholder="选择日期时间"
                       format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss">
                      </el-date-picker>
                    </template>
                  </el-form-item>
                  <!-- <el-form-item label="合同总价">
                    <template>
                      <el-input v-model="ruleForm.price" type="number" placeholder="请输入合同总价格">

                      </el-input>
                    </template>
                  </el-form-item> -->
                </div>
              </div>
            </div>
            <div>
              <!-- v-if="ruleForm.type=='2'" -->
             <el-form-item label="合同总价">
                <template>
                 <!-- <el-input v-model="ruleForm.price" type="number" placeholder="请输入合同总价格" v-if="ruleForm.type==2">
                  </el-input> -->
                  <el-input-number :precision="2" :step="0.1" v-model="ruleForm.pricea" size="small"
                  :controls="false"
                  :min="0.00"
                  placeholder="请输入合同总价格" v-if="ruleForm.type==2">
                  </el-input-number>

                  <el-input-number :precision="2" :step="0.1" v-model="ruleForm.price" size="small"
                  v-if="ruleForm.type==1"
                  :controls="false"
                  :min="0.00"
                  placeholder="请输入合同总价格">
                  </el-input-number>
                </template>
              </el-form-item>
              <el-form-item label="业务类型">
                <template>
                  <el-card class="box-card">
                    <div style="text-align: right;">
                    </div>
                    <!-- <el-popover placement="bottom-start" width="1000" trigger="click" v-model="visiblc">
                    </el-popover> -->
                      <el-button type="primary" size="mini" :loading="submitLoading" @click="type_add()">添加</el-button>
                    <el-table :data="ruleForm.bus" border style="width: 100%;">
                      <el-table-column prop="bus_id" label="id" width="80" align="center">
                      </el-table-column>
                      <el-table-column prop="bus_name" label="业务类型" align="center">
                      </el-table-column>
                      <!-- <el-table-column prop="unit" label="单位" align="center">
                        </el-table-column> -->
                        <el-table-column prop="min_price" label="最低价" align="center">
                        </el-table-column>
                        <el-table-column prop="max_price" label="最高价" align="center">
                        </el-table-column>
                      <el-table-column label="单价" align="center" width="160">
                        <template scope="scope">
                          <el-input-number :precision="2" :step="0.1" v-model="scope.row.price" size="small"
                          :controls="false" @input="proce_show(scope)">
                          </el-input-number>
                          <span class="price_row">{{scope.row.price_show}}</span>
                        </template>
                      </el-table-column>

                      <el-table-column prop="max_price" label="预估工作量" align="center">
                        <template scope="scope">
                          <div>
                            <el-input-number :precision="2" :step="0.1" v-model="scope.row.load" size="small"
                            :controls="false"
                            :min="0.00"
                            @input="load_show(scope)"
                            >
                            </el-input-number>
                          </div>
                          <!-- <div v-else>
                            <el-input-number :precision="2" :step="0.1" v-model="scope.row.price" size="small"
                            :controls="false"
                            :disabled="true"
                            :min="0.01" :max="0.99"
                            >
                            </el-input-number>
                          </div> -->
                        </template>
                      </el-table-column>

                      <el-table-column label="备注" align="center" width="150">
                        <template scope="scope">
                          <el-input v-model="scope.row.remark" size="small" placeholder="请输入备注">

                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" align="center" width="150">
                        <template scope="scope">
                          <el-popconfirm title="确定删除吗？" @onConfirm="list_del(scope)">
                            <el-button slot="reference" style="margin-left: 10px;" size="mini" icon="el-icon-delete"
                              type="danger">
                              <!-- 删除 -->
                            </el-button>
                          </el-popconfirm>
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-card>
                </template>
              </el-form-item>
              <el-form-item label="合伙人">
                <template>
                  <el-card class="box-card">
                      <el-button type="primary" size="mini"  :loading="submitLoading" @click="partner_add()">添加</el-button>
                    <el-table :data="ruleForm.partner" border style="width: 100%">
                      <el-table-column prop="uid" label="uid" width="180" align="center">
                      </el-table-column>
                      <!-- <el-table-column prop="account" label="用户名称" width="680" align="center">
                        </el-table-column> -->
                      <el-table-column prop="real_name" label="姓名" align="center">
                      </el-table-column>
                      <el-table-column label="比例" align="center" width="160">
                        <template scope="scope">
                          <el-input-number :precision="2" :step="0.1" v-model="scope.row.ratio" size="small"
                          :controls="false"  :min="0.01" :max="0.99">
                          </el-input-number>
                        </template>
                      </el-table-column>
                      <el-table-column label="备注" align="center" width="150">
                        <template scope="scope">
                          <el-input v-model="scope.row.remark" placeholder="请输入备注"></el-input>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" align="center" width="150">
                        <template scope="scope">
                          <el-popconfirm title="确定删除吗？" @onConfirm="list_p_del(scope)">
                            <el-button slot="reference" style="margin-left: 10px;" size="mini" icon="el-icon-delete"
                              type="danger">
                              <!-- 删除 -->
                            </el-button>
                          </el-popconfirm>
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-card>
                </template>
              </el-form-item>
              <!-- ruleForm.market_person_b_uid -->
              <el-form-item label="备注">
                <template>
                  <el-input v-model="ruleForm.remark" type="textarea" :rows="3" placeholder="请输入内容"></el-input>
                </template>
              </el-form-item>
              <el-form-item label="是否提醒">
                <template>
                  <el-radio v-model="ruleForm.is_tixing" :label="1">提醒</el-radio>
                  <el-radio v-model="ruleForm.is_tixing" :label="0">不提醒</el-radio>
                </template>
              </el-form-item>
              <el-form-item label="提醒日期" v-if="ruleForm.is_tixing=='1'">
                <template>
                  <div>
                    <el-date-picker v-model="ruleForm.tixing_date" type="datetime" placeholder="选择日期时间"
                       format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss">
                    </el-date-picker>
                  </div>
                </template>
              </el-form-item>
            </div>
          </el-form>
        </div>
      </div>
      <!-- 业务类型弹框 -->
      <el-dialog
        v-dialogDrag
        title="增加业务类型"
        :visible.sync="pop_type_tan"
        width="70%"
        center>
        <div>
          <div style="display: flex;justify-content: space-between;padding-bottom: 10px;">
            <el-input v-model="listQuery_type.keyword" @input="type_keyword" placeholder="请输入关键字"></el-input>
          </div>
          <el-table :data="ruleForma.bus_t" style="width: 100%" border v-loading="submitLoading"
            tooltip-effect="dark" @selection-change="select_bus" ref="multipleTable">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column width="180" prop="id" label="id" align="center">
            </el-table-column>
            <el-table-column prop="bus_name" label="业务类型" width="180" align="center">
            </el-table-column>
            <el-table-column prop="unit" label="单位" align="center">
            </el-table-column>
            <el-table-column prop="min_price" label="最低价" align="center">
            </el-table-column>
            <el-table-column prop="max_price" label="最高价" align="center">
            </el-table-column>
            <el-table-column prop="price" label="单价" align="center">
            </el-table-column>
          </el-table>
          <!-- 分页-->
          <div class="fenye">
            <el-pagination background @size-change="handleSizeChange_type"
              @current-change="handleCurrentChange_type" :current-page="listQuery_type.page"
              :page-sizes="[10, 20, 30, 40]" :page-size="listQuery_type.limit"
              layout="total, sizes, prev, pager, next, jumper" :total="listQuery_type.page_count">
            </el-pagination>
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="pop_type_tan = false">取 消</el-button>
          <el-button @click="type_ok()" type="primary">确定</el-button>
          <!-- <el-button type="primary" @click="pop_type_tan = false">确 定</el-button> -->
        </span>
      </el-dialog>
      <!-- 合伙人弹框 -->
      <el-dialog
        title="合伙人"
        :visible.sync="pop_partner_tan"
        v-dialogDrag
        width="70%"
        center>
        <div>
          <div style="display: flex;justify-content: space-between;padding-bottom: 10px;">
            <el-input v-model="listQuery.keyword" @input="coop_keyword" placeholder="请输入关键字"></el-input>
          </div>
          <el-table :data="user" style="width: 100%" border ref="multipleTablea" tooltip-effect="dark"
            @selection-change="select_user">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column prop="uid" label="uid" width="180" align="center">
            </el-table-column>
            <el-table-column prop="account" label="用户名称" width="180" align="center">
            </el-table-column>
            <el-table-column prop="real_name" label="姓名" align="center">
            </el-table-column>
          </el-table>
          <!-- 分页-->
          <div class="fenye">
            <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
              :current-page="listQuery.page" :page-sizes="[10, 20, 30, 40]" :page-size="listQuery.limit"
              layout="total, sizes, prev, pager, next, jumper" :total="listQuery.page_count">
            </el-pagination>
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="pop_partner_tan= false">取 消</el-button>
          <el-button @click="user_ok()" type="primary">确定</el-button>
          <!-- <el-button type="primary" @click="pop_type_tan = false">确 定</el-button> -->
        </span>
      </el-dialog>
      <!-- 负责人员 -->
      <el-dialog
      v-dialogDrag
        title="负责人员"
        :visible.sync="pop_charge_tan"
        width="70%"
        center>
        <div>
          <div style="display: flex;justify-content: space-between;padding-bottom: 10px;">
            <el-input v-model="listQuery.keyword" @input="respon_keyword" placeholder="请输入关键字"></el-input>
          </div>
          <el-table :data="user" border ref="singleTable"
            @current-change="select_resp">
            <el-table-column width="50" align="center">
              <template scope="scope">
                <el-radio :label="scope.row.uid" v-model="currentRowId" @change.native="getCurrentRow(scope.row)">
                  {{''}}
                </el-radio>
              </template>
            </el-table-column>
            <el-table-column property="uid" label="uid"></el-table-column>
            <el-table-column property="account" label="用户名称"></el-table-column>
            <el-table-column property="real_name" label="姓名"></el-table-column>
          </el-table>
          <div class="fenye">
            <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
              :current-page="listQuery.page" :page-sizes="[10, 20, 30, 40]" :page-size="listQuery.limit"
              layout="total, sizes, prev, pager, next, jumper" :total="listQuery.page_count">
            </el-pagination>
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="pop_charge_tan = false">取 消</el-button>
          <el-button @click="pop_charge_ok() " type="primary" :loading="submitLoading">确定</el-button>
        </span>
      </el-dialog>

      <!-- 分页-->
      <div class="bottom_button">
        <!-- <el-button>
          取消
        </el-button> -->
        <el-tooltip content="请仔细核对合同信息,合同被挂接到结算单后无法再次修改!" placement="top">
          <el-button type="primary" @click="submit_add()" :loading="submitLoading">
            添加
          </el-button>
        </el-tooltip>
      </div>
    </el-card>
  </div>
</template>
<script>
  import {
    contract_add,
    user_list,
    bus_list,
    contract_detail,
  } from '@/api/jiesuan/contract/add'
  export default {
    name: 'add',
    data() {
      return {
        currentRowId:"",
        price_show:"",
        bus_t:[],
        submitLoading: false,
        visibla: false,
        visible: false,
        visiblc: false,
        visibld: false,
        listQuery: {
          page: 1,
          limit: 10,
          keyword: "",
          page_count: 0,
        },
        listQuery_type: {
          page: 1,
          limit: 10,
          keyword: "",
          page_count: 0,
        },
        //默认弹框
        pop_type_tan:false,
        pop_partner_tan:false,
        pop_charge_tan:false,
        ruleForm: {
          shengxiao_date:'',
          qianyue_date:"",
          jiezhi_date:"",
          // title: '',
          // content: '',
          sort: 0,
          is_top: false,
          type: 1,
          is_tixing: 1,
          bus: [],
          bus_t:[],
          empty_list: [],
          partner: [],
          market_person_name:"",
          market_person_b_str:"",
          pricea:0.00,
          price:0.00,
          market_person_uid:"",
        },
        rules: {
          title: [{
            required: true,
            message: '请输入合同标题',
            trigger: 'blur'
          }],
          market_person_name: [{
            required: true,
            message: '请输入市场负责人',
            trigger: 'blur'
          }],
          contract_num: [{
            required: true,
            message: '请输入合同编号',
            trigger: 'blur'
          }],
        },
        pickerOptions: {
          shortcuts: [{
            text: '最近一周',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            }
          }],
        },
        ruleForma:{
          bus_t:[]
        },
        user: [],
        pickerOptions0: {
          disabledDate(time) {
            return time.getTime() < Date.now() - 8.64e7;
          }
        },
        fucharge:{}
      }
    },
    created() {
      //默认用户列表
      this.reqery()
      //默认业务类型
      this.bustype()
      this.bus_price()
    },
    mounted() {
      // this.submitLoading = true;
      // console.log(this.$route.query.contract_id)
      // this.submitLoading=true
      // contract_detail(this.$route.query.contract_id).then(res=>{
      //   console.log(res.data,"WWWWWWW")
      //   this.submitLoading = false;
      //   this.ruleForm=res.data
      //   this.ruleForm.title=res.data.title
      //   this.ruleForm.contract_num=res.data.contract_num
      //   this.ruleForm.entrust_unit=res.data.entrust_unit
      //   this.ruleForm.build_position=res.data.build_position
      //   this.ruleForm.type=res.data.type
      //   this.ruleForm.price=res.data.price
      //   this.ruleForm.priceq=res.data.price
      //   this.ruleForm.bus=res.data.bus
      //   this.ruleForm.partner=res.data.partner
      //   this.ruleForm.remark=res.data.remark
      //   this.ruleForm.is_tixing=res.data.is_tixing
      //   this.ruleForm.tixing_date=res.data.tixing_date_str
      //   this.ruleForm.shengxiao_date=res.data.shengxiao_date_str
      //   this.ruleForm.qianyue_date=res.data.qianyue_date_str,
      //   this.ruleForm.jiezhi_date=res.data.jiezhi_date_str
      //   this.ruleForm.market_person_name=res.data.market_person_uid_str
      //   this.ruleForm.market_person_b_str=res.data.market_person_b_uid_str

      //   // console.log(this.$refs.singleTable,"少时诵诗书")
      //   // this.$nextTick(function(){
      //   //   this.ruleForm.bus.forEach(item=>{
      //   //     console.log(item,"www")
      //   //     this.$refs.multipleTable.toggleRowSelection(item,true)
      //   //   })
      //   // })

      //   this.bustype()
      // })
      this.bus_price()
    },
    methods: {
      pop_charge_ok(){
        this.pop_charge_tan=false
        this.$refs['mark'].focus()
        this.ruleForm.market_person_uid =this.fucharge.uid
        this.ruleForm.market_person_name =this.fucharge.real_name
      },
      // 切换单选框挂接发票  methods 中
      getCurrentRow(event){
        // this.fucharge=event
          console.log(event.uid);
          // this.backmoney.huikuan_id=event.id
          // this.currentRowId = event;
       },
       //弹框
      person_click(){
        this.pop_charge_tan=true
          // console.log(event);
          // this.backmoney.huikuan_id=event.id
          // this.currentRowId = event;
       },

      //bus获取总额方法
      bus_price(){
        let qian=0.00
        //默认总价计算
        if(this.ruleForm.bus!=""){
         this.ruleForm.bus.forEach(item=>{
           console.log(item.price,"金额")
           console.log(item.load,"金额")
            qian+=item.price*item.load
         })
         console.log(qian,"老姥姥")
         this.ruleForm.price=qian
        }else{
          this.ruleForm.price=0.00
        }
      },
      //合伙人
      partner_add(){
        this.pop_partner_tan=true
      },
      //业务类型弹框
      type_add(){
        this.pop_type_tan=true
      },
      //预估工作量
      load_show(val){
        this.bus_price()
      },

      //金额变化
      proce_show(val){
        let min_price=parseFloat(val.row.min_price)
        let max_price=parseFloat(val.row.max_price)
        if(val.row.price>max_price){
          val.row.price_show="大于最大值"
        }else if(val.row.price<min_price){
          val.row.price_show="小于最小值"
        }else if(val.row.price<max_price){
          val.row.price_show=""
        }else if(val.row.price>min_price){
          val.row.price_show=""
        }
        this.bus_price()
      },
      reqery() {
        user_list(this.listQuery).then(res => {
          console.log(res.data, "wwwwwwwwwwwwwwwww")
          this.listQuery.page_count = res.count
          this.user = res.data
        })
      },
      bustype() {
        bus_list(this.listQuery_type).then(res => {
          this.listQuery_type.page_count = res.count
          this.ruleForma.bus_t=res.data
          for (var i = 0; i < this.ruleForma.bus_t.length; i++) {
            this.ruleForma.bus_t[i].bus_name=this.ruleForma.bus_t[i].title
          }
          console.log(this.ruleForma.bus_t);
        })
      },
      //每页几条数据
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
        this.listQuery.limit = val
        // this.reqery(1, val,this.listQuery);
        this.listQuery.page = 1
        this.reqery();
      },
      //跳转到
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
        this.listQuery.page = val
        this.reqery(val, this.listQuery.limit, this.listQuery);
      },

      //每页几条数据
      handleSizeChange_type(val) {
        console.log(val);
        this.listQuery_type.limit = val
        // this.reqery(1, val,this.listQuery);
        // this.listQuery_type.page = 1
        this.bustype();
        console.log(this.ruleForma.bus_t,"最终搜索")
      },
      //跳转到
      handleCurrentChange_type(val) {
        console.log(`当前页: ${val}`);
        this.listQuery_type.page = val
        // this.reqery(val, this.listQuery.limit, this.listQuery);
        // this.bustype()
        bus_list(this.listQuery_type).then(res => {
          this.listQuery_type.page_count = res.count
          this.ruleForma.bus_t=res.data
          for (var i = 0; i < this.ruleForma.bus_t.length; i++) {
            this.ruleForma.bus_t[i].bus_name=this.ruleForma.bus_t[i].title
          }
          console.log(this.ruleForma.bus_t,"接口里面");
        })
        // debugger
        console.log(this.ruleForma.bus_t,"最终搜索")
      },
      //当负责人员的值发生改变是
      respon_keyword() {
        this.reqery()
      },
      //当合作人员的值发生改变是
      coop_keyword() {
        this.reqery()
      },
      //业务类型的input值发生改变是
      type_keyword() {
        this.bustype()
      },
      //负责人员选择
      select_resp(val) {
        console.log(val)
        this.fucharge=val
      },
      //业务类型选择
      select_bus(val) {
        this.bus_t=val
        // console.log(val)
        // this.ruleForm.bus=this.ruleForm.bus.concat(val)
        // console.log(this.ruleForm.bus)
        // console.log(val,"sss")
        // this.ruleForm.bus= val
      },
      select_user(val) {
        this.ruleForm.partner_t = val
        console.log("2222222")
      },
      //新增数据提交
      submit_add() {
        this.ruleForm.bus.bus_id=this.ruleForm.bus.id
        this.ruleForm.bus.bus_name=this.ruleForm.bus.title
        console.log(this.ruleForm.bus)
        if(this.ruleForm.type==2){
          this.ruleForm.price=this.ruleForm.pricea
        }
       this.$refs.ruleForm.validate((valid) => {
         if (valid) {
            this.submitLoading = true
            console.log(this.ruleForm.title)
            contract_add(this.ruleForm).then(res => {
              console.log(res)
              if (res.code == 200) {
                this.$message({
                  message: res.msg,
                  type: 'success'
                });
                // this.ruleForm={}
                // this.reqery()
                // this.currentRowId="0"
                // this.ruleForm.type=1
                // this.reqery()
                // this.bustype()
                // this.bus_price()
                this.$router.go(-1);
                this.submitLoading = false
              }
            }).catch(() => {
              this.submitLoading = false
            })
          }
        })
      },
      type_ok(val) {
        this.pop_type_tan=false
        console.log(this.bus_t)
        this.visiblc = false
        let b = []
        for (let a = 0;a <this.bus_t.length;a++) {
          let tmp = {
            'id': this.bus_t[a].id,
            'title': this.bus_t[a].bus_name,
            'bus_name': this.bus_t[a].bus_name,
            'bus_id': this.bus_t[a].bus_id,
            'min_price':this.bus_t[a].min_price,
            'max_price':this.bus_t[a].max_price,
            'remark': '',
            'price':this.bus_t[a].price,
            'load':0.00
          }
          b.push(tmp)
        }
        console.log(b)
        this.ruleForm.bus = b
        console.log(this.ruleForm.bus,"周老板")
        // this.bus_price()
        // console.log(this.ruleForma_t.but,this.bus_t,"王老板")
        // this.ruleForm.but = this.ruleForm.but.concat(this.bus_t)

        // this.ruleForm.bus = this.ruleForm.bus.concat(this.bus_t)


        var obj = {};
        this.ruleForm.bus = this.ruleForm.bus.reduce(function(item, next) {
          obj[next.bus_id] ? '' : obj[next.bus_id] = true && item.push(next);
          return item;
        }, []);
        //将内容输出到浏览器控制台
        // for (var i = 0; i < this.ruleForm.bus.length; i++) {
        //   console.log(this.ruleForm.bus[i])
        // }
        // console.log(this.ruleForm.bus);
      },
      user_ok() {
        this.pop_partner_tan=false
        this.visibld = false
        let b = []
        for (let a = 0; a < this.ruleForm.partner_t.length; a++) {
          let tmp = {
            'real_name': this.ruleForm.partner_t[a].real_name,
            'uid': this.ruleForm.partner_t[a].uid,
            'ratio': '',
            'remark': ''
          }
          b.push(tmp)
        }
        console.log(b)
        this.ruleForm.partner_t = b

        this.ruleForm.partner = this.ruleForm.partner.concat(this.ruleForm.partner_t)


        var obj = {};
        this.ruleForm.partner = this.ruleForm.partner.reduce(function(item, next) {
          obj[next.uid] ? '' : obj[next.uid] = true && item.push(next);

          return item;

        }, []);

        //将内容输出到浏览器控制台

        for (var i = 0; i < this.ruleForm.partner.length; i++) {

          console.log(this.ruleForm.partner[i])

        }
        console.log(this.ruleForm.partner);
      },
      list_del(val) {
        console.log(val.$index)
        this.ruleForm.bus.splice(val.$index, 1);
      },
      list_p_del(val) {
        console.log(val.$index)
        this.ruleForm.partner.splice(val.$index, 1);
      }
    }
  }
</script>
<style type="text/css" scoped="scoped">
  .bottom_button {
    text-align: center;
  }

  .flex {
    display: flex;
    justify-content: space-between;
  }

  .flex>div {
    width: 50%;
  }

  .sortable-ghost {
    opacity: .8;
    color: #fff !important;
    background: #42b983 !important;
  }

  .fenye {
    padding: 20px 0px;
  }

  .el-range-editor.el-input__inner {
    width: 205px !important;
    padding: 3px 3px !important;
  }

  /* .add_over{
    height: 500px;
    overflow: auto;
    padding-right:20px ;
  } */
  /* .el-dialog--center .el-dialog__body {
      text-align: initial;
      padding: 25px 25px 30px;
      overflow: auto;
      height: 550px;
  } */
</style>
<style type="text/css">
  .el-table--striped .el-table__body tr.el-table__row--striped.current-row td,
  .el-table__body tr.current-row>td {
    background-color: #a0cfff;
  }
  .price_row{
    color: red;
  }
  /* .el-radio__label {
      display: none;
  } */
</style>
